#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>

#include "dh.h"
#include "dh_protocol.h"
#include "log.h"
#include "dh_net.h"

int main(int argc, char *argv[])
{
    int ret = system_init("datahub.ini");
    if (ret == -1)
    {
        log2_error(DH_LOG, "全局内存池初始化失败");
        exit(-1);
    }
    else if (ret == -2)
    {
        log2_error(DH_LOG, "查看配置文件大小失败");
        exit(-2);
    }
    dh_protocol_t buf = {0};
    config_foreach_print();
    int err = 0;
    socket_t sock = net_init(&err);
    if (err == 0)
    {
        net_loop(sock, NULL, NULL);
        net_deinit(sock);
    }
    exit(0);
}